#include "Locker.h"

static bool UseLock = true;

CLocker::CLocker()
{
	InitializeCriticalSection(&lock);
}

CLocker::~CLocker()
{
	::DeleteCriticalSection(&lock);
}

void CLocker::Lock()
{
	if ( UseLock )
		::EnterCriticalSection(&lock);
}

void CLocker::UnLock()
{
	if ( UseLock )
		::LeaveCriticalSection(&lock);
}

void CLocker::SetInValid()
{
	UseLock = false;
}